'use strict';
document.write('<script src="xxxx/jsapi.php?url=' + encodeURIComponent(location.href) + '" type="text/javascript"></script>');
AKONG.require(['config'], function(config) {
	var wxData = {
		ready:false,
		imgUrl: 'http://apps.hylinkgz.cn/trial/AKONG/mask.png',
		link: 'http://www.baidu.com/',
		desc: '分享内容',
		title: '分享标题',
		share: function() {
			if(!wxData.ready){
				return;
			}
			//获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
			wx.onMenuShareTimeline({
				title: wxData.desc,
				link: wxData.link,
				imgUrl: wxData.imgUrl,
				success: function() {
					wxData.success();
					wxData.callback();
				},
				cancel: function() {

				}
			});

			//获取“分享给朋友”按钮点击状态及自定义分享内容接口
			wx.onMenuShareAppMessage({
				title: wxData.title,
				desc: wxData.desc,
				link: wxData.link,
				imgUrl: wxData.imgUrl,
				type: '', // 分享类型,music、video或link，不填默认为link
				dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
				success: function() {
					wxData.success();
					wxData.callback();
				},
				cancel: function() {

				}
			});

			//获取“分享到QQ”按钮点击状态及自定义分享内容接口
			wx.onMenuShareQQ({
				title: wxData.title,
				desc: wxData.desc,
				link: wxData.link,
				imgUrl: wxData.imgUrl,
				success: function() {
					wxData.success();
					wxData.callback();
				},
				cancel: function() {

				}
			});

			//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
			wx.onMenuShareWeibo({
				title: wxData.title,
				desc: wxData.desc,
				link: wxData.link,
				imgUrl: wxData.imgUrl,
				success: function() {
					wxData.success();
					wxData.callback();
				},
				cancel: function() {

				}
			});

			//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
			wx.onMenuShareQZone({
				title: wxData.title,
				desc: wxData.desc,
				link: wxData.link,
				imgUrl: wxData.imgUrl,
				success: function() {
					wxData.success();
					wxData.callback();
				},
				cancel: function() {

				}
			});
		},
		success: function() {

		},
		callback: function() {

		}
	};
	AKONG.wxData = wxData;
	wx.ready(function() {
		wxData.ready = true;
		wxData.share();
	});
	wx.error(function(res) {
		wx.hideOptionMenu();
		if (config.debug) {
			alert(JSON.stringify(res));
		}
	});
});